package com.xhtranslate.common.config;

import com.baidu.aip.ocr.AipOcr;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author liuxuhuang
 * @version 1.0
 * @package com.xhtranslate.common.config
 * @date 2022/11/11 15:37:18
 * @description 百度图片ocr图片配置bean
 */
@Configuration
public class BaiduOcrConfigBean {
    @Bean
    public AipOcr setAipOcrConfig() {
        // 初始化一个AipOcr
        AipOcr client = new AipOcr(TranslateConfig.BaiduOcrAppId, TranslateConfig.BaiduOcrApiId, TranslateConfig.BaiduOcrSecreKey);
        // 可选：设置网络连接参数
        client.setConnectionTimeoutInMillis(2000);
        client.setSocketTimeoutInMillis(60000);
        return client;
    }


}
